/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CargarSeccion.java
 *
 * Created on 17/02/2011, 10:59:43 AM
 */
package Pantallas;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 *
 * @author Reinaldo Carvallo
 */
public class CargarSeccion extends javax.swing.JFrame {

    /** Creates new form CargarSeccion */
    public CargarSeccion() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        txtNombre = new javax.swing.JTextField();
        txtEstudiantes = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(null);

        jLabel1.setText("Cargar Seccion");
        getContentPane().add(jLabel1);
        jLabel1.setBounds(210, 20, 100, 30);

        jLabel2.setText("Nombre de la seccion");
        getContentPane().add(jLabel2);
        jLabel2.setBounds(70, 110, 150, 20);

        jLabel3.setText("Cantidad Estudiantes");
        getContentPane().add(jLabel3);
        jLabel3.setBounds(70, 170, 130, 14);
        getContentPane().add(txtNombre);
        txtNombre.setBounds(230, 110, 180, 20);
        getContentPane().add(txtEstudiantes);
        txtEstudiantes.setBounds(230, 170, 180, 20);

        jButton1.setText("Aceptar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton1);
        jButton1.setBounds(210, 250, 100, 20);

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-500)/2, (screenSize.height-360)/2, 500, 360);
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        if (txtEstudiantes.getText().equals("") || txtNombre.getText().equals("")) {
            JOptionPane.showMessageDialog(new JFrame(),"Debe Introducir todos los datos","Aviso",JOptionPane.CANCEL_OPTION);


        } else {
            MenuPrincipal.s1.setNombre(txtNombre.getText());
            MenuPrincipal.s1.setCantidad_estudiantes(Integer.parseInt(txtEstudiantes.getText()));
            JOptionPane.showMessageDialog(new JFrame(),"Sección Creada Exitosamente","Aviso",JOptionPane.CANCEL_OPTION);

            
            dispose();

        }
    }//GEN-LAST:event_jButton1ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new CargarSeccion().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JTextField txtEstudiantes;
    private javax.swing.JTextField txtNombre;
    // End of variables declaration//GEN-END:variables
}
